import HttpAxios from "../../components/http/HttpAxios";
import {RuleDomain} from "./RuleDomain";

class RuleService{

  baseUrl = process.env.POINT_SERVICE_URL;
  httpClient= new HttpAxios();

  queryListUtl="/query/activities/all";
  queryListByHostUtl="/query/activities/host/";
  ruleAddUrl="/activities/save";

  addPointUrl ="/points/reward";

  enableAccountUrl="/activities/enable/";
  disableAccountUrl="/activities/disable/";

  queryList(call){
    const body =  this.httpClient.get(this.baseUrl+this.queryListUtl,{},call);
  }
  queryListByHost(host:string,call){
    const body =  this.httpClient.get(this.baseUrl+this.queryListByHostUtl+host,{},call);
  }

  addRule(token:string,data,call){
    const body =  this.httpClient.postAndToken(this.baseUrl+this.ruleAddUrl,data,token,call);
  }

  addPoint(token:string,data,call){
    this.httpClient.postAndToken(this.baseUrl+this.addPointUrl,data,token,call);
  }

  enableRule(activityId:string,token:string,callback){
    this.httpClient.getAndToken(this.baseUrl+this.enableAccountUrl+activityId,{},token,callback);
  }

  disableRule(activityId:string,token:string,callback){
    this.httpClient.getAndToken(this.baseUrl+this.disableAccountUrl+activityId,{},token,callback);
  }

}

export default RuleService;
